package com.lqs.blog.controller;

import com.lqs.blog.pojo.SysUser;
import com.lqs.blog.service.SysUserService;
import com.lqs.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("users")
public class UsersController {
    @Autowired
    private SysUserService sysUserService;

    @GetMapping("currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token) {//@RequestHeader注解用于映射请求头数据到Controller方法的对应参数
        return sysUserService.getUserByToken(token);
    }
}
